package cn.zymx.webTM.web.controller;

import cn.zymx.webTM.web.dao.entity.Chatroom;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/room")
public class RoomController {
	@Autowired
//	private ChatroomMapper chatroomMapper;

	@RequestMapping(value = "/getRoomList", produces = "application/json;charset=utf-8")
	@ResponseBody
	public String getRoomList(HttpSession session) {
//		List<Chatroom> chatrooms = chatroomMapper.selectByExample(null);
		List<Chatroom> chatrooms = new ArrayList<>();
		Chatroom e = new Chatroom();
		e.setChatroomId(1l);
		e.setName("测试聊天室34343");
		chatrooms.add(e);
		String s = JSONObject.toJSONString(chatrooms);
		return  s;
	}
}
